Tootsville::With-Posted-Json

Macro

With-Posted-Json names a macro, with lambda list ((&REST Λ-LIST) &BODY BODY):

Execute BODY with Λ-LIST values from JSON body of a POST.

Each variable named in Λ-LIST will be bound to the JONATHAN::PARSE (not in this manual) contents of the analogous (camel-case) key name in the POSTed parameter object.

For example,

@lisp (WITH-POSTED-JSON (FOO-BAR) (BODY)) @end lisp

… will bind FOO-BAR to the value of the key "fooBar" in the POST content, assuming it is a JSON object like

 { "fooBar": "value" }

In the event of a parse error, an HTTP 400 is returned.

File

Defined in file src/web.lisp.